package com.jkdz.spyke.rs
{
	import com.jkgh.remedy.core.client.*;

	public class RemoteSystem implements RemedyRemoteSystem
	{

		public function createProxy(classID:int, remoteeID:int, connection:RemedyClientServerConnection):RemedyMethodObject
		{
			switch (classID)
			{
				case 68: return new SpykeWidgetConstructorProxy(remoteeID, connection);
				case 71: return new SpykeWidgetListenerProxy(remoteeID, connection);
				case 64: return new SpykeWebcamProxy(remoteeID, connection);
				case 65: return new SpykeWidgetProxy(remoteeID, connection);
				case 36: return new SpykeFileSharerListenerProxy(remoteeID, connection);
				case 8: return new SpykeAbstractCommunicatorProxy(remoteeID, connection);
				case 40: return new SpykePaintProxy(remoteeID, connection);
				case 45: return new SpykePaintListenerProxy(remoteeID, connection);
				case 16: return new SpykeAbstractCommunicatorListenerProxy(remoteeID, connection);
				case 19: return new SpykeChatRoomProxy(remoteeID, connection);
				case 49: return new SpykeRoomProxy(remoteeID, connection);
				case 48: return new SpykePhoneProxy(remoteeID, connection);
				case 54: return new SpykeServerProxy(remoteeID, connection);
				case 52: return new SpykeRoomListenerProxy(remoteeID, connection);
				case 24: return new SpykeChatRoomListenerProxy(remoteeID, connection);
				case 57: return new SpykeURLDisplayProxy(remoteeID, connection);
				case 27: return new SpykeFileChunkProviderProxy(remoteeID, connection);
				case 29: return new SpykeFileSharerProxy(remoteeID, connection);
				case 62: return new SpykeURLDisplayListenerProxy(remoteeID, connection);
			}
			return null;
		}

		public function createRemoter(classID:int, mo:RemedyMethodObject):RemedyRemoter
		{
			switch (classID)
			{
				case 68: return new SpykeWidgetConstructorRemoter((SpykeWidgetConstructor)(mo));
				case 71: return new SpykeWidgetListenerRemoter((SpykeWidgetListener)(mo));
				case 64: return new SpykeWebcamRemoter((SpykeWebcam)(mo));
				case 65: return new SpykeWidgetRemoter((SpykeWidget)(mo));
				case 36: return new SpykeFileSharerListenerRemoter((SpykeFileSharerListener)(mo));
				case 8: return new SpykeAbstractCommunicatorRemoter((SpykeAbstractCommunicator)(mo));
				case 40: return new SpykePaintRemoter((SpykePaint)(mo));
				case 45: return new SpykePaintListenerRemoter((SpykePaintListener)(mo));
				case 16: return new SpykeAbstractCommunicatorListenerRemoter((SpykeAbstractCommunicatorListener)(mo));
				case 19: return new SpykeChatRoomRemoter((SpykeChatRoom)(mo));
				case 49: return new SpykeRoomRemoter((SpykeRoom)(mo));
				case 48: return new SpykePhoneRemoter((SpykePhone)(mo));
				case 54: return new SpykeServerRemoter((SpykeServer)(mo));
				case 52: return new SpykeRoomListenerRemoter((SpykeRoomListener)(mo));
				case 24: return new SpykeChatRoomListenerRemoter((SpykeChatRoomListener)(mo));
				case 57: return new SpykeURLDisplayRemoter((SpykeURLDisplay)(mo));
				case 27: return new SpykeFileChunkProviderRemoter((SpykeFileChunkProvider)(mo));
				case 29: return new SpykeFileSharerRemoter((SpykeFileSharer)(mo));
				case 62: return new SpykeURLDisplayListenerRemoter((SpykeURLDisplayListener)(mo));
			}
			return null;
		}

		public function getMOClassID(mo:RemedyMethodObject):int
		{
			if (mo is SpykeWebcam)
			{
				return 64;
			}
			if (mo is SpykePhone)
			{
				return 48;
			}
			if (mo is SpykeWidgetConstructor)
			{
				return 68;
			}
			if (mo is SpykeFileSharerListener)
			{
				return 36;
			}
			if (mo is SpykeAbstractCommunicator)
			{
				return 8;
			}
			if (mo is SpykePaint)
			{
				return 40;
			}
			if (mo is SpykePaintListener)
			{
				return 45;
			}
			if (mo is SpykeAbstractCommunicatorListener)
			{
				return 16;
			}
			if (mo is SpykeChatRoom)
			{
				return 19;
			}
			if (mo is SpykeChatRoomListener)
			{
				return 24;
			}
			if (mo is SpykeURLDisplay)
			{
				return 57;
			}
			if (mo is SpykeFileSharer)
			{
				return 29;
			}
			if (mo is SpykeURLDisplayListener)
			{
				return 62;
			}
			if (mo is SpykeWidgetListener)
			{
				return 71;
			}
			if (mo is SpykeWidget)
			{
				return 65;
			}
			if (mo is SpykeRoom)
			{
				return 49;
			}
			if (mo is SpykeServer)
			{
				return 54;
			}
			if (mo is SpykeRoomListener)
			{
				return 52;
			}
			if (mo is SpykeFileChunkProvider)
			{
				return 27;
			}
			return 0;
		}

		public function createDataObject(classID:int, connection:RemedyClientServerConnection, graph:Vector.<Object>):Object
		{
			switch (classID)
			{
				case 73: return FileInfo.readWithGraph(connection, graph);
				case 74: return PaintSettings.readWithGraph(connection, graph);
			}
			return null;
		}

		public function getManagerOfClassID(classID:int):RemedyClassManager
		{
			switch (classID)
			{
				case 4: return RemedyDoubleClassManager.INSTANCE;
				case 5: return RemedyDOClassManager.INSTANCE;
				case 3: return RemedyDOClassManager.INSTANCE;
				case 2: return RemedyIntegerClassManager.INSTANCE;
				case 1: return RemedyStringClassManager.INSTANCE;
				case 7: return RemedyBlobClassManager.INSTANCE;
				case 6: return RemedyDOClassManager.INSTANCE;
				case 74: return RemedyDOClassManager.INSTANCE;
				case 73: return RemedyDOClassManager.INSTANCE;
				case 40: return RemedyMOClassManager.INSTANCE;
				case 52: return RemedyMOClassManager.INSTANCE;
				case 49: return RemedyMOClassManager.INSTANCE;
				case 19: return RemedyMOClassManager.INSTANCE;
				case 29: return RemedyMOClassManager.INSTANCE;
				case 62: return RemedyMOClassManager.INSTANCE;
				case 54: return RemedyMOClassManager.INSTANCE;
				case 68: return RemedyMOClassManager.INSTANCE;
				case 8: return RemedyMOClassManager.INSTANCE;
				case 16: return RemedyMOClassManager.INSTANCE;
				case 71: return RemedyMOClassManager.INSTANCE;
				case 24: return RemedyMOClassManager.INSTANCE;
				case 27: return RemedyMOClassManager.INSTANCE;
				case 36: return RemedyMOClassManager.INSTANCE;
				case 48: return RemedyMOClassManager.INSTANCE;
				case 65: return RemedyMOClassManager.INSTANCE;
				case 64: return RemedyMOClassManager.INSTANCE;
				case 45: return RemedyMOClassManager.INSTANCE;
				case 57: return RemedyMOClassManager.INSTANCE;
			}
			return null;
		}
	}
}
